<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body onload="init()">
		<script>
			var w;
			function init(){
				w=new WebSocket("ws://localhost:8080/nsd_websocket1014/abcd");
				w.onclose=function(){
					console.log("关闭连接")
				}
				w.onerror=function(){
					console.log("发生错误")
				}
				w.onopen=function(){
					console.log("我已成功建立连接")
				}
				w.onmessage=function(e){
					alert(e.data)
				}
			}
		</script>
	</body>
</html>
